#!/bin/sh
cd `dirname $0` || exit 0

WORKDIR=`pwd`/..
cd ${WORKDIR}

MODEL_NAME=hi3518e
PLATFORM=HIS
TARGET_SUBFIX=HIS.HI3536V100
PRODUCT_MODEL=HISOME-NVR40000
BOARD_NAME=HI3536_12HDMI_MBA0
ARCH=HI3518E

VERSION=1.0.0

if [ "$1" = "-h" -o "$1" = "--help" ]
then
	echo "Build firmware"
	echo "Usage:"
	echo "$0"
	exit -1 
fi

make clean

echo "Makeing TARGET.mk_${TARGET_SUBFIX}"
ln -sf TARGETS/TARGET.mk_${TARGET_SUBFIX} TARGET.mk

make all -j10
if [ $? != 0 ]
then
	echo "Making TARGET.mk_${TARGET_SUBFIX} fail"
	exit -1
fi

#create tgz 
#VERSION=`unset LANG; svn info | sed -n '/^Revision/s/Revision:[[:space:]]*\([[:digit:]]\+\)/\1/p'`;

#mkdir -p hisome/bin
#cp platform/*.bin hisome/bin
cp platform/release.bin release/release.bin
#tar czf  release/${PLATFORM}.${BOARD_NAME}.${PRODUCT_MODEL}_${ARCH}_v${VERSION}_`date +%Y%m%d`.tar.gz hisome

